#ifndef SERIALTHREAD_H
#define SERIALTHREAD_H


#include "serialportsmanager.h"
#include <QSerialPort>
#include <QThread>


class FrameWindow;
class ATCommandItem;

class SerialThread : public QThread
{
    Q_OBJECT

public:

    QMap<QString,SerialPortsManager*> *COMMap;
    explicit  SerialThread(FrameWindow *frameWindow);
    ~SerialThread();
    virtual void run();
    int init();

    /*
     * 线程是否结束
     */
    volatile  bool isTerminate;

public:
signals:

    void sendData(QString  data);//向主线程发送接收到的串口数据
    void receiveData(QByteArray);
    void sendResult(QString send,QString rev,int result);
public slots:

private:
    FrameWindow *parent;

     int dealData(QString COM, ATCommandItem comm,QByteArray rec);

     int initialPorts();



};

#endif // SERIALTHREAD_H
